//
//  AdvisoryModel.m
//  YZZX
//
//  Created by Easaa on 15/6/10.
//  Copyright (c) 2015年 Easaa. All rights reserved.
//

#import "AdvisoryModel.h"

@implementation AdvisoryModel


-(id)initWithDataManagement:(NSDictionary *)dic
{
    self = [super init];
    if(self)
    {
        if(dic == NULL)
        {
            return NULL;
        }
        self.Content                        = [dic objectForKey:@"Content"];
        self.ReceiverName                   = [dic objectForKey:@"ReceiverName"];
        self.ReceiverPhoto                  = [dic objectForKey:@"ReceiverPhoto"];
        self.ReplyContent                   = [dic objectForKey:@"ReplyContent"];
        
        if([[dic objectForKey:@"ReplyTime"] isEqual:[NSNull null]])
        {
            self.ReplyTime = @"";
        
        
        }else if (![[dic objectForKey:@"ReplyTime"] isEqual:[NSNull null]])
        {
            //时间转换
            NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init];
            [dateformatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
            NSDate *date = [dateformatter dateFromString:[dic objectForKey:@"ReplyTime"]];
            [dateformatter setDateFormat:@"yyyy-MM-dd"];
            NSString *strtime = [dateformatter stringFromDate:date];
            
            self.ReplyTime                      = strtime;
        }
        
        
        
        if([[dic objectForKey:@"SendTime"] isEqual:[NSNull null]])
        {
            self.SendTime = @"";
            
            
        }else if (![[dic objectForKey:@"SendTime"] isEqual:[NSNull null]])
        {
            NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init];
            [dateformatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
            NSDate *Senddate = [dateformatter dateFromString:[dic objectForKey:@"SendTime"]];
            [dateformatter setDateFormat:@"yyyy-MM-dd"];
            NSString *Sendstrtime = [dateformatter stringFromDate:Senddate];
            
            self.SendTime                       = Sendstrtime;
        }

       
        
       
        
        
        
        self.SenderName                     = [dic objectForKey:@"SenderName"];
        self.Title                          = [dic objectForKey:@"Title"];
        self.id_massge                      = [[dic objectForKey:@"id"] stringValue];
    }
    
    return self;
    
}


@end
